package com.mall.user.domain.exception;

/**
 * 用户已存在异常
 * 当尝试创建已存在的用户时抛出
 */
public class UserAlreadyExistsException extends RuntimeException {
    
    private final String userName;
    
    public UserAlreadyExistsException(String userName) {
        super("用户已存在: " + userName);
        this.userName = userName;
    }
    
    public UserAlreadyExistsException(String userName, String message) {
        super(message);
        this.userName = userName;
    }
    
    public UserAlreadyExistsException(String userName, String message, Throwable cause) {
        super(message, cause);
        this.userName = userName;
    }
    
    public String getUserName() {
        return userName;
    }
}